#ifndef COMMON_IO_H
#define COMMON_IO_H 1

#include <common/macro/build.h>
#include <stdio.h>
#include <sys/types.h>


typedef FILE* iohandle_t;

API_LIBLOCAL inline iohandle_t io_open(const char *, int, int);
API_LIBLOCAL inline iohandle_t io_open_rwc(const char *);
API_LIBLOCAL inline iohandle_t io_open_w(const char *);
API_LIBLOCAL inline iohandle_t io_open_r(const char *);
API_LIBLOCAL inline int io_remove(const char *);
API_LIBLOCAL inline size_t io_read(void *, size_t, size_t, iohandle_t io);
API_LIBLOCAL inline size_t io_write(const void *, size_t, size_t, iohandle_t io);
API_LIBLOCAL inline int io_seek(iohandle_t, off_t, int);
API_LIBLOCAL inline off_t io_tell(iohandle_t);
API_LIBLOCAL inline int io_close(iohandle_t);
API_LIBLOCAL inline int io_sync(iohandle_t);
API_LIBLOCAL inline int io_truncate(iohandle_t, off_t);
API_LIBLOCAL inline int io_feof(iohandle_t);
API_LIBLOCAL inline int io_valid(iohandle_t);

#endif
